#!/bin/bash

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${SCRIPT_DIR}"

REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "${REPO_ROOT}"

export TZ=UTC

DATE="$(date --date='1 day ago' '+%Y%m%d')"

echo "$@"

RET=0

source /remote/iosg/home/bot-coin/miniconda3/etc/profile.d/conda.sh
conda activate /remote/iosg/home/bot-coin/miniconda3/envs/coin2_motion_env
cd python

./pyrunner coin/support/feed_tool/feed_stats/app/coin2_raw_feed_checker.py \
  --date=${DATE} "$@" || RET="${?}"

conda deactivate
exit "${RET}"
